class FaquestionsController < ApplicationController
	def index
	  @category = FaqCategory.find_by_id(params[:category_id])
	  if @category
	    @faquestions = Faquestion.paginate_by_sql("select f.* from faquestions f join faquestions_faq_categories c on f.id=c.faquestion_id where c.faq_category_id=#{@category.id} order by created_at DESC", :page => params[:page], :per_page => 10)
	  else
		  @faquestions = Faquestion.paginate(:per_page => 10, :page => params[:page], :order => "created_at DESC")
	  end
	end

	def show
		@faquestion = Faquestion.find_by_id(params[:id])
	end

end
